package com.whiteape.book.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;

import androidx.core.content.ContextCompat;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceViewHolder;

import com.whiteape.book.R;

public class MyPreferenceCategory extends PreferenceCategory {
    public MyPreferenceCategory(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

//    @Override
//    protected void onBindView(View view) {
//        super.onBindView(view);
//        view.setBackgroundColor(Color.parseColor("#b0000000"));
//        if (view instanceof TextView) {
//            TextView tv = (TextView) view;
//            tv.setTextSize(16);
//            tv.setTextColor(Color.BLACK);
//        }
//    }

    @Override
    public void onBindViewHolder(PreferenceViewHolder holder) {
        super.onBindViewHolder(holder);
        View view = holder.itemView;
        if(view instanceof TextView){
            ((TextView)view).setTextColor(ContextCompat.getColor(getContext(), R.color.colorAccent));
        }
    }
}